Warning fixes in jeeps: move use closer to initialization so that the
authorRobert Lipe <robertlipe@gpsbabel.org>
Mon, 3 Dec 2018 06:37:29 +0000 (00:37 -0600)
committerRobert Lipe <robertlipe@gpsbabel.org>
Mon, 3 Dec 2018 06:37:29 +0000 (00:37 -0600)
test of device is effective, don't set locals before return.

jeeps/gpsserial.cc
mac/libusb/darwin.c

index 26343a89b860aca5f95819dc82c34f708b82a94d..147f4c8b49371d20a2a1e017f380e42b151e7a56 100644 (file)
@@ -610,8 +610,6 @@ int32 GPS_Serial_Off(gpsdevh* dh)
     gps_errno = HARDWARE_ERROR;
     return 0;
   }
-  dh = nullptr;
-
   return 1;
 }
 
index 749e09eccc13f7193736f43e65fab333a8a1f142..d52b6b75743ae65c0140e46eb7bd22e93b6ca1e7 100644 (file)
@@ -283,9 +283,6 @@ int usb_os_open(usb_dev_handle *dev)
 
   usb_device_t **darwin_device;
 
-  UInt32 location = *((UInt32 *)dev->device->dev);
-  UInt32 dlocation;
-
   if (!dev)
     USB_ERROR(-ENXIO);
 
@@ -304,6 +301,10 @@ int usb_os_open(usb_dev_handle *dev)
   if ((result = usb_setup_iterator (&deviceIterator)) < 0)
     return result;
 
+  UInt32 location = *((UInt32 *)dev->device->dev);
+  UInt32 dlocation;
+
+
   /* This port of libusb uses locations to keep track of devices. */
   while ((darwin_device = usb_get_next_device (deviceIterator, &dlocation)) != NULL) {
     if (dlocation == location)